<!--
 * @Author: xinyang3
 * @Date: 2021-11-15 09:13
 * @Descripttion: awesome description
 * @LastEditors: xinyang3
 * @LastEditTime: 2022-04-02 18:08
-->
<template>
  <div class='blogs'>
    <h2 class='title tl mt5'>
      <i class='icon iconfont icon-list-like mr5'></i>最新文章
    </h2>
    <ul class='h-list pl20 pr20'>
      <blog-card v-for='blog in blogs' :key='blog._id' v-bind:blog='blog'></blog-card>
    </ul>
  </div>
</template>
<script>
import { defineComponent, reactive, computed, ref } from "vue";
import request from "@/request/index";
import BlogCard from "views/components/blog-card.vue";
export default defineComponent({
  name: "blogs-new",
  components: {
    BlogCard,
  },
  setup () {
    const blogs = ref([]);
    request
      .get("/blog/list", { sortField: "update_date", order: -1 })
      .then((response) => {
        blogs.value = response.data;
      });

    // http://117.132.185.58:20030/ngnwmh5/apps/earlyWarn_c7076845.css
    fetch("http://127.0.0.1:8050/bgmg/blog/list?sortField=update_date&order=-1", {
      cache: "no-cache", // *default, no-cache, reload, force-cache, only-if-cached
      headers: {
        "Content-Type": "application/json",
        "aaa": "123",
      },
      method: "get", // *GET, POST, PUT, DELETE, etc.
      // mode: "no-cors", // no-cors, cors, *same-origin
      redirect: "follow", // manual, *follow, error
      referrer: "no-referrer", // *client, no-referrer
    })
      .then((response) => {
        console.log(response)
      });

    return {
      blogs,
    };
  },
});
</script>

<style></style>
